<?php

namespace App\Http\Controllers;

use App\Http\Requests\Request;
use Dingo\Api\Auth\Auth;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /**
     * gameapi
     * 2018/10/8 9:13
     * Administrator
     * userIdentity
     * 网站系统添加账户agent_id=0,代理账户取代理id
     * @return int
     */
    public function userIdentity()
    {
        $user = \Auth::user();
        switch ($user->type) {
            case 0:
                return 0;
                break;
            case 1:
                return $user->agent()->first()->id;
                break;
            default:
                return 0;
        }
    }
}
